﻿using Bandit.Helpers;
using Bandit.UI.MVVM;
using ETC.DLEDPositionTool.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;

namespace ETC.DLEDPositionTool.ViewModels
{
    public class SettingViewModel : NotifyObject
    {
        #region Setting
        /// <summary>
        /// Setting
        /// </summary>
        public Setting Setting { get; private set; }
        #endregion

        #region OnClick
        /// <summary>
        /// Click Event
        /// </summary>
        public ICommand OnClick { get; set; }
        #endregion

        #region Constructors[构造函数]

        public SettingViewModel()
        {
            if (System.IO.File.Exists(Models.Setting.SavePath))
            {
                this.Setting = ConfigHelper.XmlFileDeserialize<Setting>(Setting.SavePath);
            }
            else
            {
                this.Setting = new Setting();
                string languageCode = System.Globalization.CultureInfo.InstalledUICulture.Name;
                switch (languageCode)
                {
                    case "zh-CN":
                    case "zh-TW":
                        this.Setting.Language = languageCode;
                        break;
                    default:
                        break;
                }

                this.Setting.Theme = "Dark";
            }
        }

        #endregion
    }
}
